package SimilarAlgorithm;

public class BookSimiarity implements Similarity<Book> {
	private Similarity<String> textSimiarity=null;
	
	public BookSimiarity(Similarity<String> textSimilarity){
		this.textSimiarity=textSimilarity;
	}
	
	public double getSimilarity(Book t1, Book t2) {
		float author_weighting=0.8f;
		float bookname_weighting=0.1f;
		float content_weighting=0.1f;
		double author_sim=textSimiarity.getSimilarity(t1.getAuthor(), t2.getAuthor());
		double bookname_sim=textSimiarity.getSimilarity(t1.getBookName(), t2.getBookName());
		double content_sim=textSimiarity.getSimilarity(t1.getContent(), t2.getContent());
		
		double similarity=(author_weighting*author_sim+bookname_weighting*bookname_sim+content_weighting*content_sim);
		return similarity;
	}


}
